package com.diver.flinkdemo.entity.xxt.xiaoyang;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author ywy
 * 2021/4/6 16:41
 */

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DevRemind extends XyBase {

    /**
     * 说明:闹铃格式为：时间-开关-频率(1：一次；2:每天;3：自定义)
     * 08:10-1-1：闹钟时间 8:10，打开，响铃一次
     * 08:10-1-2：闹钟时间 8:10，打开，每天响铃
     * 08:10-1-3-0111110：闹钟时间 8:10，打开，自定义周一至周五打开
     * 说明：闹钟设置最多支持同时设置 5 个
     * example: "08:10-1-1,08:10-1-2,08:10-1-3-0111110"
     */
    @JsonProperty(value = "AC1")
    private String AC1;
    @JsonProperty(value = "AC2")
    private String AC2;
    @JsonProperty(value = "AC3")
    private String AC3;


    public String getRemind() {
        Stream.Builder<String> builder = Stream.builder();
        if (StringUtils.isNotEmpty(this.AC1)) {
            builder.add(this.AC1);
        }
        if (StringUtils.isNotEmpty(this.AC2)) {
            builder.add(this.AC2);
        }
        if (StringUtils.isNotEmpty(this.AC3)) {
            builder.add(this.AC3);
        }
        return builder.build().collect(Collectors.joining(","));
    }
}
